package builder.trainer.counter;

import java.util.HashMap;

public class Attribute {

	private String attributeName;
	private HashMap<String, AttributeValue> attributeValues;
	private double entropy;
	private int index;
	
	
	private Counter counter;

	public Attribute(String attributeName, Counter counter, int i) {
		this.attributeName = attributeName;
		this.counter = counter;
		this.index = i;
		this.setCategoryValues(new HashMap<String, AttributeValue>());
	}

	public String getAttributeName() {
		return attributeName;
	}

	public void addAttributeValue(String valueName,
			AttributeValue attributeValue) {
		this.getAttributeValues().put(valueName, attributeValue);
	}

	public void setCategoryValues(
			HashMap<String, AttributeValue> attributeValues) {
		this.attributeValues = attributeValues;
	}

	public HashMap<String, AttributeValue> getAttributeValues() {
		return attributeValues;
	}

	public void addValue(String sValue, int index) {
		AttributeValue value = this.attributeValues.get(sValue);
		if (value == null) {
			value = new AttributeValue(sValue, this.counter);
			this.attributeValues.put(sValue, value);
		}
		value.addIndex(index);
	}

	public void setEntropy(double entropy) {
		this.entropy = entropy;
	}

	public double getEntropy() {
		return this.entropy;
	}

	public int getIndex() {
		// TODO Auto-generated method stub
		return this.index;
	}
}
